# 设置最低 CMake 版本要求
cmake_minimum_required(VERSION 3.20)

#设置c++17
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
#选择新的gcc实现
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=1)
add_definitions(-DFMT_HEADER_ONLY)

# 设置构建类型为 Debug
if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif()

# 根据构建类型设置编译选项
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -O0")

project(HFT)

# 查找当前目录下的所有源文件
# 并将名称保存到 DIR_SRCS 变量
aux_source_directory(. DIR_SRCS)

SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) #设置可执行文件的输出目录

# Includes and libraries
include_directories( 
  include
)

#链接库文件
#link_directories(lib)
#链接库文件
link_directories(/usr/local/lib)
link_directories(/usr/lib)
link_directories(${PROJECT_SOURCE_DIR}/lib)

# 设置共享库的输出目录
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)

# 设置静态库的输出目录
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)

# 添加  子目录
add_subdirectory(src)

set(EXE_NAME hft)

#编译为可执行程序
add_executable(${EXE_NAME} ${DIR_SRCS})

# 添加链接库
target_link_libraries(${EXE_NAME} orderServer)
